import React from 'react';
import {
  View,
} from 'react-native';

import SizeUtils from '../../common/SizeUtils';
import Config from '../../config';
import CommonSearchListPage from '../common/CommonSearchListPage';
import HeartLoveSearchAction from '../../actions/heart/HeartLoveSearchAction';
import HeartLoveItemView from './HeartLoveItemView';

export default class HeartLoveSearchNickPage extends CommonSearchListPage {
  constructor(props) {
    super(props);
  }

  _renderTopView() {
    return (
      <View style={{flexDirection:"row",
         borderColor: '#eeeeee',
         height:SizeUtils.translateDesignHeightToCode(90),
         paddingLeft:SizeUtils.translateDesignWidthToCode(40),
         paddingRight:SizeUtils.translateDesignWidthToCode(40),
         borderBottomWidth: SizeUtils.translateDesignNumToCode(3)}}>
        {this._renderSearchBg()}
      </View>
    )
  }

  _getSearchBarContainerStyle() {
    return {width:SizeUtils.getWindowSize().width - SizeUtils.translateDesignWidthToCode(160),
      borderTopWidth:0,borderBottomWidth:0,
      height:SizeUtils.translateDesignHeightToCode(62),backgroundColor:"#00000000",};
  }

  _getListViewStyle() {
    return {
        height:(SizeUtils.getWindowSize().height - Config.paddingTop - SizeUtils.translateDesignHeightToCode(40 + 90)),
        backgroundColor:"#ffffff"};
  }

  _onPressNavigationBarRightBtn() {
    this.gotoPage(Config.pages.heart_love_search_condition);
  }

  _sendAction(page, listView) {
    let sendData = {page:page, nick:this.state.searchText};
    new HeartLoveSearchAction().call(listView, sendData)
  }

  _onRenderItem(data, index) {
    return <HeartLoveItemView data={data} key={index} myLoveData={this.props.pageData.routeData.myLoveData} />;
  }

  _dealLeavePage() {

  }

  goBack() {
    this.setState({searchText:null});
    this.clear();
    if (!this.props.isInster) {
      super.goBack();
    }
  }
}
